let app = getApp()
Component({
    properties: {
        styleType: {
            type: String
          },
          level: {
            type: String
          }
      },
      data:{
        cur:0
      },
    lifetimes: {
        attached: function () {
            var that=this
            wx.request({
            url: app.globalData.siteroot,
            data: {
            do:'Goods_getGoodsClass'
           },
           success: function(res) {
               that.setData({
                  list:res.data.data,
                  catid:res.data.data[0].id
               })
               that.goodlist(res.data.data[0].id)
             }
         })
       }
      },
    methods: {
        catlist:function(e)
        {
            this.setData({
                cur:e.detail.cur,
                catid:e.detail.catid
            })
            this.goodlist(e.detail.catid)
        },
        goodlist:function(class_id){
            var that=this
            wx.request({
            url: app.globalData.siteroot,
            data: {
            do:'Goods_getGoods',
            class_id:class_id
           },
           success: function(res) {
                 that.setData({
                     good_list:res.data.data
                 }) 
             }
         })
        }
    }
});
